import { createRequest } from '/@/api/service';
const module = 'ib/order/v1/AppWorkOrderApi';

/**
 * @function 查询工单列表
 * @param data
 * @param header
 * @returns {Promise}
 */
function QUERY_APP_WORK_ORDER_LIST(
  data: AppOrderWorkOrder.QueryAppWorkOrderListReq,
  header: object = {},
): Promise<AppOrderWorkOrder.QueryAppWorkOrderListResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/queryAppWorkOrderList`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 查看工单详情
 * @param data
 * @param header
 * @returns {Promise}
 */
function QUERY_APP_WORK_ORDER_DETAIL(
  data: AppOrderWorkOrder.QueryAppWorkOrderDetailReq,
  header: object = {},
): Promise<AppOrderWorkOrder.QueryAppWorkOrderDetailResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/queryAppWorkOrderDetail`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 状态工单数量统计
 * @param data
 * @param header
 * @returns {Promise}
 */
function COUNT_APP_STATUS_QUANTITY(
  data: AppOrderWorkOrder.CountAppStatusQuantityReq,
  header: object = {},
): Promise<AppOrderWorkOrder.CountAppStatusQuantityResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/countAppStatusQuantity`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 接单
 * @param data
 * @param header
 * @returns {Promise}
 */
function RECEIVE_APP_TASK(
  data: AppOrderWorkOrder.ReceiveAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.ReceiveAppTaskResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/receiveAppTask`, data, header, 'POST');
}

/**
 * @function 处理工单
 * @param data
 * @param header
 * @returns {Promise}
 */
function PROCESS_APP_TASK(
  data: AppOrderWorkOrder.ProcessAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.ProcessAppTaskResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/processAppTask`, data, header, 'POST');
}

/**
 * @function 回退
 * @param data
 * @param header
 * @returns {Promise}
 */
function BACK_APP_TASK(
  data: AppOrderWorkOrder.BackAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.BackAppTaskResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/backAppTask`, data, header, 'POST');
}

/**
 * @function 挂起
 * @param data
 * @param header
 * @returns {Promise}
 */
function SUSPEND_APP_TASK(
  data: AppOrderWorkOrder.SuspendAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.SuspendAppTaskResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/suspendAppTask`, data, header, 'POST');
}

/**
 * @function 解挂
 * @param data
 * @param header
 * @returns {Promise}
 */
function RESUME_APP_TASK(
  data: AppOrderWorkOrder.ResumeAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.ResumeAppTaskResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/resumeAppTask`, data, header, 'POST');
}

/**
 * @function 转派
 * @param data
 * @param header
 * @returns {Promise}
 */
function FORWARD_APP_TASK(
  data: AppOrderWorkOrder.ForwardAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.ForwardAppTaskResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/forwardAppTask`, data, header, 'POST');
}

/**
 * @function 协同
 * @param data
 * @param header
 * @returns {Promise}
 */
function COOPERATE_APP_TASK(
  data: AppOrderWorkOrder.CooperateAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.CooperateAppTaskResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/cooperateAppTask`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 协同完成
 * @param data
 * @param header
 * @returns {Promise}
 */
function COOPERATE_COMPLETE_APP_TASK(
  data: AppOrderWorkOrder.CooperateCompleteAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.CooperateCompleteAppTaskResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/cooperateCompleteAppTask`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 评价
 * @param data
 * @param header
 * @returns {Promise}
 */
function EVALUATE_APP_TASK(
  data: AppOrderWorkOrder.EvaluateAppTaskReq,
  header: object = {},
): Promise<AppOrderWorkOrder.EvaluateAppTaskResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/evaluateAppTask`, data, header, 'POST');
}

export {
  QUERY_APP_WORK_ORDER_LIST,
  QUERY_APP_WORK_ORDER_DETAIL,
  COUNT_APP_STATUS_QUANTITY,
  RECEIVE_APP_TASK,
  PROCESS_APP_TASK,
  BACK_APP_TASK,
  SUSPEND_APP_TASK,
  RESUME_APP_TASK,
  FORWARD_APP_TASK,
  COOPERATE_APP_TASK,
  COOPERATE_COMPLETE_APP_TASK,
  EVALUATE_APP_TASK,
};
